<template>
  <rx-layout>

    <div slot="center" style>
      <rx-fit :isheader="isheader">
        <div slot="toolheader"  foldheader="true" foldbtn="false" border="false">
          <div class="table-operator">
            <a-button  type="primary" icon="plus" @click="add">{{$ti18('rxList.newBtn','新建')}}</a-button>

          </div>
          <span class="search-btn-box"  v-if="!isheader">
            <span class="search-btn" @click.stop="searchshow"><i class="iconfont iconguolv"></i>{{$ti18('rxList.leachBtn','过滤')}}</span>
          </span>
        </div>
         <div  btnalign="right" slot="searchbar" v-if="fitSearch" @search="search" @cancel="cancel" @close="closeSearchbar">
           <a-form :layout="colLayout">
             <a-row :gutter="24">
               <a-col :span="colSpan">
             <a-form-item :label="$ti18('rxForm.key','编码')">
                    <a-input :placeholder="$ti18('rxDecorator.input','请输入') +' ' + $ti18('rxForm.key','编码')" v-model="queryParam.Q_CODE__S_LK" />
                  </a-form-item>
               </a-col>
               <a-col :span="colSpan">
                  <a-form-item :label="i18n('form.name','名称')">
                    <a-input :placeholder="i18n('form.name','名称','input')" v-model="queryParam.Q_NAME__S_LK" />
                  </a-form-item>
               </a-col>
               <a-col :span="colSpan">
                   <a-form-item :label="i18n('form.descp','描述')">
                      <a-input :placeholder="i18n('form.descp','描述','input')" v-model="queryParam.Q_DESCP__S_LK" />
                    </a-form-item>
               </a-col>
             </a-row>
          </a-form>
        </div>
        <div class="gridBox">
          <rx-grid
            ref="table"
            :bordered="isBorder"
            :multiSelect="true"
            :columns="columns"
            :defaultPageSize="10"
            :pageSizeOptions="['10','30','40']"
            id-field="id"
            @selectChange="onSelectChange"
            :queryParam="queryParam"
            url="/api-user/user/org/osUserType/query"
            data-field="result.data"
          >

            <span slot="action" slot-scope="{text, record}" class="actionIcons">
              <span v-if="editEnable" @click="edit(record)">{{$ti18('rxList.editBtn','编辑')}}</span>
              <span v-if="removeEnable" @click="delByIds([record.id])">{{$ti18('rxList.delBtn','删除')}}</span>
            </span>
          </rx-grid>
        </div>
      </rx-fit>
    </div>
  </rx-layout>
</template>

<script>
import OsusertypeApi from '@/api/user/org/osUserType'
import OsUserTypeEdit from './OsUserTypeEdit'

import {BaseList, RxLayout, RxFit, Rxgrid, Util} from "@lowcode/jpaas-common-lib"
import OsGroupMenuEdit from "./OsGroupMenuEdit";
export default {
  name: 'OsUserTypeList',
  mixins: [BaseList],
  components: {
    OsUserTypeEdit,
    RxLayout,
    RxFit,
    Rxgrid
  },
  data() {
    return {
      // 查询参数
      queryParam: {},

      // 表头
      columns: [
        {
          title: this.$ti18('rxList.index','序号'),
          type:'indexColumn',
          dataIndex: 'serial',
          width:80,
          scopedSlots: { customRender: 'serial' },
        },
        {
          title: this.$ti18('rxForm.key','编码'),
          width:160,
          dataIndex: 'code',
        },
        {
          title: this.i18n('form.name','名称'),
          width:160,
          dataIndex: 'name',
        },
        {
          title: this.i18n('form.descp','描述'),
          width:160,
          dataIndex: 'descp',
        },
        {title: this.$ti18('rxForm.createTime','创建时间'), dataIndex: 'createTime', sorter: true, sortField: 'CREATE_TIME_', width: 120},
        {
          title: this.$ti18('rxList.action','操作'),
          width:60,
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' }
        }
      ],
      component: OsUserTypeEdit,
      comment: this.i18n('list.userType','用户类型'),
      widthHeight: ['800px', '650px'],
    }
  },
  methods: {
    i18n(name,text,key){
          return this.$ti18(name,text,"osUserType",key);
    },
    getListByParams(parameter) {
      return OsusertypeApi.query(parameter)
    },
    // 删除
    delById(ids) {
      return OsusertypeApi.del({ ids: ids.join(',') })
    },

     search(){
        this.$refs.table.loadData();
      },
      cancel(){
        this.resetSearch();
      },
    closeSearchbar(){
      //关闭过滤弹窗；（点击X触发）
      this.fitSearch = false ;
    },
  }
}
</script>
<style scoped>

.gridBox{
  height: 100%;
  box-sizing: border-box;
}

</style>

